﻿using System.Collections.ObjectModel;
using MyFloridaHouse.libSvCommonUtilities;
using MyFloridaHouse.ServiceConn.DistrBldrSvcRef;
using MyFloridaHouse.libSvOpenDistricts.StorageIsolated;
using MyFloridaHouse.libSvUtilities;
using System;
using MyFloridaHouse.libSvOpenDistricts.enumerations;

namespace MyFloridaHouse.libSvOpenDistricts.ViewModel
{

    //public partial class ViewModelBase
    //{
    //    private bool _isFileSaveAsActive = false;
    //    public bool isFileSaveAsActive
    //    {
    //        get { return _isFileSaveAsActive; }
    //        set
    //        {
    //            if (_isFileSaveAsActive != value)
    //            {
    //                _isFileSaveAsActive = value;
    //                RaisePropertyChanged("isFileSaveAsActive");
    //                if (fileSaveFileSource==0)
    //                {
    //                    fileSaveFileSource = enumFileSaveFileSource.ISOLATED;
    //                    RaisePropertyChanged("fileSaveFileSource");
    //                }
    //            }
    //        }
    //    }

    //    private ObservableCollection<FileInfoDTO> _fileSaveAsFileNameList = new ObservableCollection<FileInfoDTO>();
    //    public ObservableCollection<FileInfoDTO> fileSaveAsFileNameList
    //    {
    //        get { return _fileSaveAsFileNameList; }
    //        set
    //        {
    //            _fileSaveAsFileNameList = value;
    //            RaisePropertyChanged("fileSaveAsFileNameList");
    //        }
    //    }

    //    private int _fileSaveAsFileNameListSelectedIndex = -1;
    //    public int fileSaveAsFileNameListSelectedIndex
    //    {
    //        get { return _fileSaveAsFileNameListSelectedIndex; }
    //        set
    //        {
    //            if (_fileSaveAsFileNameListSelectedIndex != value)
    //            {
    //                _fileSaveAsFileNameListSelectedIndex = value;
    //                if ((_fileSaveAsFileNameListSelectedIndex < 0) | (_fileSaveAsFileNameListSelectedIndex > _fileSaveAsFileNameList.Count - 1))
    //                {
    //                    fileSaveAsFileName = "";
    //                }
    //                else
    //                {
    //                    fileSaveAsFileName = fileSaveAsFileNameList[fileSaveAsFileNameListSelectedIndex].fileName;
    //                }
    //                RaisePropertyChanged("fileSaveAsFileNameListSelectedIndex");
    //            }
    //        }
    //    }


    //    private string _fileSaveAsFileName="";
    //    public string fileSaveAsFileName
    //    {
    //        get { return _fileSaveAsFileName; }
    //        set { if (_fileSaveAsFileName != value) { _fileSaveAsFileName = value; RaisePropertyChanged("fileSaveAsFileName"); } }
    //    }

    //    #region commands
    //    #region File SaveAs
    //    private bool CmdFileSaveAsCanExecute(object parameter)
    //    {
    //        //todo: Enable FileSaveAs when ready
    //        return false;
    //        //return ((!isFileSaveAsActive) & (districtPlan.districtCount > 0));
    //    }

    //    private void CmdFileSaveAsExecute(object parameter)
    //    {
    //        IsolatedStorageManager.GetFileInfo(Constants.DistrictPlanDirectoryName, "*" + Constants.DistrictPlanFileNameExtension, fileSaveAsFileNameList);
    //        fileSaveAsFileNameListSelectedIndex = -1;
    //        isFileSaveAsActive = true;
    //    }
    //    #endregion

    //    #region File SaveAs Cancel
    //    private bool CmdFileSaveAsCancelCanExecute(object parameter)
    //    {
    //        return true;
    //    }

    //    private void CmdFileSaveAsCancelExecute(object parameter)
    //    {
    //        isFileSaveAsActive = false;
    //    }
    //    #endregion

    //    #region File SaveAs OK
    //    private bool CmdFileSaveAsOKCanExecute(object parameter)
    //    {
    //        if (fileSaveFileSource == enumFileSaveFileSource.LOCAL)
    //        {
    //            return true;
    //        }
    //        else
    //        {
    //            return (fileSaveAsFileName.Length > 0);
    //        }
    //    }

    //    private void CmdFileSaveAsOKExecute(object parameter)
    //    {
    //        try
    //        {
    //            if (fileSaveFileSource == enumFileSaveFileSource.ISOLATED)
    //            {
    //                // only format for internal storage is XML
    //                districtPlan.districtPlanFileName = fileSaveAsFileName;
    //                districtPlan.SaveIsolatedXML();
    //            }
    //            else if (fileSaveFileSource == enumFileSaveFileSource.LOCAL)
    //            {
    //                //TODO: add other output types such as DOJ, Bill Languange, etc. to FileSaveAs
    //                //TODO: Can't specify output file name until Operating system dialog, need to overwrite current planfilename with saved planfilename
    //                districtPlan.SaveLocalXML();
    //            }
    //            isFileSaveAsActive = false;
    //        }
    //        catch (Exception ex)
    //        {
    //            //todo: need to log an error
    //            string errStr = ex.ToString();
    //        }
    //    }
    //    #endregion

    //    #endregion


    //}
}
